<?php
    class Model {
    	public function __construct()
    	{
            spl_autoload_register(array('Doctrine', 'autoload'));
            spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
            $manager = Doctrine_Manager::getInstance();
            try {
              $conn = Doctrine_Manager::connection(DB_TIPO.'://'.DB_USER.':'.DB_PASS.'@'.DB_HOST.'/'.DB_NAME);
              $manager->setAttribute(Doctrine_Core::ATTR_MODEL_LOADING, Doctrine_Core::MODEL_LOADING_CONSERVATIVE);
              $manager->setAttribute(Doctrine_Core::ATTR_EXPORT, Doctrine_Core::EXPORT_ALL);
              $profiler = new Doctrine_Connection_Profiler();
              $manager->setListener($profiler);
            } catch (Doctrine_Manager_Exception $e) {
              print $e->getMessage();
            }
            Doctrine_Core::loadModels('models');   
      }
    }